package com.dhl.cloud.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.dhl.cloud.common.Constants;
import com.dhl.cloud.common.http.HttpResult;
import com.dhl.cloud.common.vo.ComFrontBean;
import com.dhl.cloud.course.entity.LessionTransaudio;
import com.dhl.cloud.course.service.LessionTransaudioService;

@RestController
@RequestMapping(value = "/user")
public class LessionTransaudioController extends BaseController{

	@Autowired
	private LessionTransaudioService lessionTransaudioService;
	
    @GetMapping("getMyLessionTransaudioList")
    public HttpResult getMyLessionTransaudioList(Integer lessionid)
    {
        List<LessionTransaudio> list = lessionTransaudioService.selectByLessionid(lessionid);
        return HttpResult.success("",list);
    }
    
    @PostMapping("deleteLessionTransaudio")
    public HttpResult deleteLessionTransaudio(@RequestBody ComFrontBean ComFrontBean,HttpServletRequest request)
    {
        int flag = lessionTransaudioService.deleteByPrimaryKey(ComFrontBean.getId());
        return flag==1 ? HttpResult.success("删除成功"):HttpResult.error(Constants.ERROR_MSG_25);
    }
    
    @PostMapping("saveLessionTransaudio")
    public HttpResult saveLessionTransaudio(@RequestBody LessionTransaudio lessionfile,HttpServletRequest request)
    {
        int flag = lessionTransaudioService.insert(lessionfile);
        return flag==1 ? HttpResult.success("操作成功"):HttpResult.error(Constants.ERROR_MSG_25);
    }
}
